﻿using Microsoft.AspNetCore.Mvc.ModelBinding;
using System;
using System.Collections.Generic;
using System.Text;

namespace Common.Web.EnumBinder
{
    /// <summary>
    /// 枚举绑定器提供者
    /// </summary>
    public class EnumBinderProvider : IModelBinderProvider
    {
        /// <summary>
        /// 枚举绑定器提供者
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public IModelBinder GetBinder(ModelBinderProviderContext context)
        {
            return context.Metadata.IsEnum ? new EnumModelBinder() : null;
        }
    }
}
